package org.jeecg.modules.system.model;

import org.jeecg.modules.system.entity.SysRegion;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;

public class SysRegionTreeModel implements Serializable {
    private static final long serialVersionUID = 1L;

    /** 对应SysDepart中的id字段,前端数据树中的key*/
    private String key;

    /** 对应SysDepart中的id字段,前端数据树中的value*/
    private String value;

    /** 对应depart_name字段,前端数据树中的title*/
    private String title;


    private boolean isLeaf;
    // 以下所有字段均与YksRegion相同
    /**ID*/

    private java.lang.String id;
    /**名称*/

    private java.lang.String name;
    /**代码*/

    private java.lang.String code;
    /**父代码*/

    private java.lang.String parentCode;
    /**创建时间*/

    private java.util.Date createTime;
    /**创建者*/

    private java.lang.String createBy;
    /**更新者*/

    private java.lang.String updateBy;
    /**更新时间*/

    private java.util.Date updateTime;
    /**版本号乐观锁*/
    private java.lang.Integer version;
    /**是否删除*/

    private java.lang.Integer delFlag;
    /**简称*/

    private java.lang.String shortName;
    /**类型*/

    private java.lang.Integer regionType;
    /**边框大小*/

    private java.lang.Integer borderSize;
    /**地图级别*/

    private java.lang.Integer mapLevel;
    /**描述*/

    private java.lang.String description;
    /**排序*/

    private java.lang.Integer sort;
    /**经纬度*/

    private java.lang.String lonlat;
    /**辖区no*/

    private java.lang.String no;
    /**租户ID*/

    private java.lang.String tenantId;
    /**租户业务隔离ID*/

    private java.lang.String tenantBusinessId;
    /**父级节点*/

    private java.lang.String pid;
    /**是否有子节点*/

    private java.lang.String hasChild;


    private List<SysRegionTreeModel> children = new ArrayList<>();


    /**
     * 将SysDepart对象转换成SysDepartTreeModel对象
     * @param yksRegion
     */
    public SysRegionTreeModel(SysRegion sysRegion) {
        this.key = sysRegion.getId();
        this.value = sysRegion.getId();
        this.title = sysRegion.getName();
        this.id = sysRegion.getId();
        this.pid = sysRegion.getPid();
        this.name = sysRegion.getName();
        this.code = sysRegion.getCode();
        this.parentCode = sysRegion.getParentCode();
        this.shortName = sysRegion.getShortName();
        this.description = sysRegion.getDescription();
        this.regionType = sysRegion.getRegionType();
        this.borderSize = sysRegion.getBorderSize();
        this.mapLevel = sysRegion.getMapLevel();
        this.sort = sysRegion.getSort();
        this.lonlat = sysRegion.getLonlat();
        this.no = sysRegion.getNo();
        this.tenantId = sysRegion.getTenantId();
        this.tenantBusinessId = sysRegion.getTenantBusinessId();
        this.delFlag = sysRegion.getDelFlag();
        this.version = sysRegion.getVersion();
        this.createBy = sysRegion.getCreateBy();
        this.createTime = sysRegion.getCreateTime();
        this.updateBy = sysRegion.getUpdateBy();
        this.updateTime = sysRegion.getUpdateTime();
        this.hasChild = sysRegion.getHasChild();
    }

    public boolean getIsLeaf() {
        return isLeaf;
    }

    public void setIsLeaf(boolean isleaf) {
        this.isLeaf = isleaf;
    }

    public String getKey() {
        return key;
    }


    public void setKey(String key) {
        this.key = key;
    }


    public String getValue() {
        return value;
    }


    public void setValue(String value) {
        this.value = value;
    }


    public String getTitle() {
        return title;
    }


    public void setTitle(String title) {
        this.title = title;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<SysRegionTreeModel> getChildren() {
        return children;
    }

    public void setChildren(List<SysRegionTreeModel> children) {
        if (children==null){
            this.isLeaf=true;
        }
        this.children = children;
    }

    public String getParentId() {
        return pid;
    }

    public void setParentId(String parentId) {
        this.pid = parentId;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getName() {
        return name;
    }

    public void setName(String Name) {
        this.name = Name;
    }


    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }



    public int getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(int delFlag) {
        this.delFlag = delFlag;
    }



    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public SysRegionTreeModel() { }

//    public String getDirectorUserIds() {
//        return directorUserIds;
//    }
//
//    public void setDirectorUserIds(String directorUserIds) {
//        this.directorUserIds = directorUserIds;
//    }

    /**
     * 重写equals方法
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SysRegionTreeModel model = (SysRegionTreeModel) o;
        return Objects.equals(id, model.id) &&
                Objects.equals(pid, model.pid) &&
                Objects.equals(name, model.name) &&
                Objects.equals(code, model.code) &&
                Objects.equals(parentCode, model.parentCode) &&
                Objects.equals(sort, model.sort) &&
                Objects.equals(createBy, model.createBy) &&
                Objects.equals(createTime, model.createTime) &&
                Objects.equals(updateBy, model.updateBy) &&
                Objects.equals(updateTime, model.updateTime) &&
                Objects.equals(version, model.version) &&
                Objects.equals(delFlag, model.delFlag) &&
                Objects.equals(shortName, model.shortName) &&
                Objects.equals(regionType, model.regionType) &&
                Objects.equals(borderSize, model.borderSize) &&
                Objects.equals(mapLevel, model.mapLevel) &&
                Objects.equals(description, model.description) &&
                Objects.equals(lonlat, model.lonlat) &&
                Objects.equals(no, model.no) &&
                Objects.equals(tenantId, model.tenantId) &&
                Objects.equals(tenantBusinessId, model.tenantBusinessId) &&
                Objects.equals(hasChild, model.hasChild) &&

                Objects.equals(children, model.children);
    }

    /**
     * 重写hashCode方法
     */
    @Override
    public int hashCode() {

        return Objects.hash(id, pid, name,code,parentCode,version,shortName,
                sort, description, regionType, borderSize, mapLevel, lonlat, no, tenantId,
                tenantBusinessId, hasChild, delFlag, createBy, createTime, updateBy, updateTime,
                children);
    }
}
